class People{
  constructor (name){
    this.name = name
  }
  eat(foo){
    console.log(`${this.name} eat ${foo}`)
  }
}

class Student extends People{
  constructor(name, number){
    super(name)
    this.number = number
  }
  say(echo){
    console.log(`${echo} ${this.name}, number is: ${this.number}`)
  }
}

p = new Student('hugo', 28)
console.log(p.name, p.number)
p.eat('banana')
p.say("hello")

console.log(p.__proto__) // 实例的隐式原型
console.log(Student.prototype) // class 的显式原型

console.log(p.__proto__ === Student.prototype) // true
console.log(p.__proto__ === People.prototype) // false
console.log(Student.prototype === People.prototype) // false
console.log(Student.prototype.__proto__ === People.prototype) // true

// p.eat
console.log(p.__proto__.__proto__.eat)

// 判断对象自身属性中是否具有指定的属性
console.log(p.hasOwnProperty("name")) // true
console.log(p.hasOwnProperty("eat")) // false